package com.itheima.day05;

public class change {
    public static void main(String[] args) {

//int基本数据类型不会改变主方法里的值
//引用方法会在执行之后消失数据无法保留
        /*int number = 100;
        System.out.println("change调用前="+number);
        change1(number);
        System.out.println("change调用后="+number);*/

//数组是引用变量 会改变数值
//引用数据类型 会新建一个new(在堆里开通一片空间)会覆盖原有元素
        int[] arr = new int[]{10, 20, 30};
        System.out.println("change调用前=" + arr[2]);
        change1(arr);
        System.out.println("change调用后=" + arr[2]);
    }

    public static void change1(int[] brr) {

        /*System.out.println("change1="+number);
        number = 200;
        System.out.println("change1="+number);*/

        System.out.println("change1=" + brr[2]);
        brr[2] = 200;
        System.out.println("change1=" + brr[2]);
    }
}
